import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
//第一步：导入axios
import axios from "axios"

Vue.config.productionTip = false
//设置axios请求的拦截器
axios.interceptors.request.use(config=>{
  //从LocalStorage中获取令牌信息
  var token = localStorage.getItem("token");
  //判断是否获取token
  if (token){
    //把token信息放入请求头
    config.headers.token=token;
  }
  return config;
})


//第二步：把axios挂载到Vue对象
Vue.prototype.$http=axios
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
